package com.zry.fertilizer.retrofit

import com.zry.fertilizer.been.*
import com.zry.fertilizer.update.UpdateAppInfo
import retrofit2.http.*
import rx.Observable


/**
 * 数据接口api
 */


interface ApiDynamic {
    /**
     * 登陆
     */
    @FormUrlEncoded
    @POST("login")
    fun loginApi(@Field("username") username: String, @Field("password") password: String,
                 @Field("juris") juris: String): Observable<HttpResponse<LoginInfoBean>>

    /**
     * 获取产品列表
     */
    @FormUrlEncoded
    @POST("GetProductList")
    fun GetProductList(@Field("enterpriseId") enterpriseId: String): Observable<MutableList<ProductInfo>>

    /**
     * 获取生产批次
     */
    @FormUrlEncoded
    @POST("GetBatchByProductId")
    fun GetBatchByProductId(@Field("productId") productId: String): Observable<MutableList<BatchInfo>>

    /**
     * 获取生产线
     */
    @FormUrlEncoded
    @POST("GetProductionLine")
    fun GetProductionLine(@Field("enterpriseId") enterpriseId: String): Observable<MutableList<ProductLine>>

    /**
     * 获取装箱单位列表
     */
    @FormUrlEncoded
    @POST("GetPackList")
    fun GetPackList(): Observable<MutableList<PacKBean>>

    /**
     * 根据短追溯码获取长追溯码
     */
    @FormUrlEncoded
    @POST("GetCodeID")
    fun GetCodeID(@Field("newCode") newCode: String): Observable<ResultCode>

    /**
     * 根据短流通码获取长流通吗
     */
    @FormUrlEncoded
    @POST("GetFlowCode")
    fun GetFlowCode(@Field("newCode") newCode: String): Observable<ResultFlowCode>

    /**
     * 批量打包
     */
    @FormUrlEncoded
    @POST("AddLiangFlow")
    fun AddLiangFlow(@Field("level") level: String, @Field("ProductID") ProductID: String, @Field("UnitID") UnitID: String,
                     @Field("SonCodeNum") SonCodeNum: String, @Field("CodeS") CodeS: String, @Field("UserID") UserID: String,
                     @Field("EnterpriseID") EnterpriseID: String): Observable<ResultCodeData<MutableList<PackResultCode>>>

    /**
     * 号段打包
     */
    @FormUrlEncoded
    @POST("AddDuanFlow")
    fun AddDuanFlow(@Field("level") level: String, @Field("ProductID") ProductID: String,
                    @Field("UnitID") UnitID: String, @Field("SonCodeNum") SonCodeNum: String,
                    @Field("MaxCode") MaxCode: String, @Field("MinCode") MinCode: String,
                    @Field("UserID") UserID: String, @Field("EnterpriseID") EnterpriseID: String)
            : Observable<ResultCodeData<MutableList<PackResultCode>>>


    /**
     * 获取装箱记录
     */
    @FormUrlEncoded
    @POST("GetFlowCodeList")
    fun GetFlowCodeList(@Field("EnterpriseID") EnterpriseID: String, @Field("CreateUserID") CreateUserID: String,
                        @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int): Observable<MutableList<FlowCode>>

    /**
     * 获取批量打包记录详情
     */
    @FormUrlEncoded
    @POST("GetFlowCodeDetailList")
    fun GetFlowCodeDetailList(@Field("FlowCodeID") FlowCodeID: String): Observable<HttpResponse<FlowCodeDetail>>

    /**
     * 获取入库订单列表
     */
    @FormUrlEncoded
    @POST("GetStoreOrderList")
    fun GetStoreOrderList(@Field("EnterpriseID") EnterpriseID: String, @Field("pageIndex") pageIndex: Int,
                          @Field("pageSize") pageSize: Int, @Field("ProductID") ProductID: String,
                          @Field("OrderState") OrderState: String, @Field("OrderCode") OrderCode: String): Observable<MutableList<StoreOrderBean>>

    /**
     * 批量入库
     */
    @FormUrlEncoded
    @POST("AddLiangStore")
    fun AddLiangStore(@Field("OrderID") OrderID: String, @Field("CodeS") CodeS: String,
                      @Field("StoreDate") StoreDate: String, @Field("UserID") UserID: String): Observable<ResultCodeData<MutableList<PackResultCode>>>

    /**
     * 号段入库
     */
    @FormUrlEncoded
    @POST("AddDuanStore")
    fun AddDuanStore(@Field("OrderID") OrderID: String, @Field("MaxCode") MaxCode: String, @Field("MinCode") MinCode: String,
                     @Field("StoreDate") StoreDate: String, @Field("UserID") UserID: String): Observable<ResultCodeData<MutableList<PackResultCode>>>

    /**
     * 入库记录
     */
    @FormUrlEncoded
    @POST("GetStoreDetailList")
    fun GetStoreDetailList(@Field("CreateUserID") CreateUserID: String, @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int): Observable<MutableList<StoreDetail>>

    /**
     * 入库记录详情
     */
    @FormUrlEncoded
    @POST("GetStoreDetailInfo")
    fun GetStoreDetailInfo(@Field("DetailID") DetailID: String): Observable<StoreDetail>


    /**
     * 批量出库
     */
    @FormUrlEncoded
    @POST("AddLiangOutStockDetail")
    fun AddLiangOutStockDetail(@Field("OutStockID") OutStockID: String, @Field("ProductID") ProductID: String,
                               @Field("OutLevel") OutLevel: String, @Field("CodeS") CodeS: String,
                               @Field("CreateUserID") CreateUserID: String, @Field("EnterpriseID") EnterpriseID: String)
            : Observable<ResultCodeData<MutableList<PackResultCode>>>

    /**
     * 号段出库
     */
    @FormUrlEncoded
    @POST("AddDuanOutStockDetail")
    fun AddDuanOutStockDetail(@Field("OutStockID") OutStockID: String, @Field("ProductID") ProductID: String, @Field("OutLevel") OutLevel: String,
                              @Field("MinCode") MinCode: String, @Field("MaxCode") MaxCode: String, @Field("CreateUserID") CreateUserID: String,
                              @Field("EnterpriseID") EnterpriseID: String): Observable<ResultCodeData<MutableList<PackResultCode>>>

    /**
     * 出库记录
     */
    @FormUrlEncoded
    @POST("GetOutDetailList")
    fun GetOutDetailList(@Field("CreateUserID") CreateUserID: String, @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int)
            : Observable<MutableList<OutDetailBean>>

    /**
     * 出库记录详情
     */
    @FormUrlEncoded
    @POST("GetOutDetailInfo")
    fun GetOutDetailInfo(@Field("DetailID") DetailID: String): Observable<OutDetailBean>

    /**
     * 补码装箱、分箱拆码获取短码的信息
     */
    @FormUrlEncoded
    @POST("GetFlowCodeInfo")
    fun GetFlowCodeInfo(@Field("CodeID") CodeID: String): Observable<FlowCodeInfo>

    /**
     *补码入箱
     */
    @FormUrlEncoded
    @POST("ComplementFlow")
    fun ComplementFlow(@Field("CodeID") CodeID: String, @Field("SonCode") SonCode: String,
                       @Field("EnterpriseID") EnterpriseID: String, @Field("CreateUserID") CreateUserID: String): Observable<FlowCodeInfo>

    /**
     * 拆码出箱
     */
    @FormUrlEncoded
    @POST("DismantlingFlow")
    fun DismantlingFlow(@Field("CodeID") CodeID: String, @Field("SonCode") SonCode: String, @Field("EnterpriseID") EnterpriseID: String,
                        @Field("CreateUserID") CreateUserID: String): Observable<FlowCodeInfo>

    /**
     * 补码入箱、拆码出箱记录
     */
    @FormUrlEncoded
    @POST("GetFlowRecordList")
    fun GetFlowRecordList(@Field("CreateUserID") CreateUserID: String, @Field("EnterpriseID") EnterpriseID: String,
                          @Field("StateID") StateID: String, @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int)
            : Observable<MutableList<FlowRecord>>

//    /**
//     * 补码、拆码详情
//     */
//    @POST("GetFlowRecordInfo")
//    fun GetFlowRecordInfo(@Field("RecordID") RecordID: String): Observable<FlowRecordInfo>

    /**
     * 检验当前是否有新版本
     */
    @FormUrlEncoded
    @POST("checkApp")
    fun checkApp(@Field("vNumber") vNumber: String, @Field("VersionType") VersionType: String): Observable<UpdateAppInfo>


    /**
     * App新接口
     */
    /**
     * 获取产品列表
     */
    @FormUrlEncoded
    @POST("GetProductByProductNameList")
    fun GetProductByProductNameList(@Field("EnterpriseID") EnterpriseID: String, @Field("ProName") ProName: String,
                                    @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int): Observable<ResultBean<MutableList<ProductNameBean>>>

    /**
     * 获取溯源录入列表
     */
    @FormUrlEncoded
    @POST("GetBatchAllList")
    fun GetBatchAllList(@Field("EnterpriseID") EnterpriseID: String, @Field("Pid") Pid: String, @Field("bid") bid: String,
                        @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int): Observable<ResultBean<MutableList<BatchInfoBean>>>

    /**
     * 获取批次详情
     */
    @FormUrlEncoded
    @POST("GetBatchInfo")
    fun GetBatchInfo(@Field("bid") bid: String): Observable<ResultBean<BatchNextInfo>>

    /**
     * 获取模板列表
     */
    @FormUrlEncoded
    @POST("OnLoadingBatchModel")
    fun OnLoadingBatchModel(@Field("EnterpriseID") EnterpriseID: String, @Field("ProductID") ProductID: String): Observable<MutableList<ModelBean>>

    /**
     * 提交创建批次
     */
    @FormUrlEncoded
    @POST("AddBatchInfo")
    fun AddBatchInfo(@Field("EnterpriseID") EnterpriseID: String, @Field("CreateUserID") CreateUserID: String,
                     @Field("BatchName") BatchName: String, @Field("ProductID") ProductID: String,
                     @Field("ModelID") ModelID: String): Observable<ResultBean<FlowCode>>

    /**
     * 入库订单详情
     */
    @FormUrlEncoded
    @POST("GetStoreOrderInfo")
    fun GetStoreOrderInfo(@Field("OrderID") OrderID: String): Observable<ResultBean<StoreOrderInfo>>

    /**
     * 结单
     */
    @FormUrlEncoded
    @POST("FinishOrderInfo")
    fun FinishOrderInfo(@Field("OrderID") OrderID: String, @Field("remark") remark: String, @Field("CreateUserID") CreateUserID: String): Observable<ResultBean<StoreOrderInfo>>

    /**
     * 出库订单列表
     */
    @FormUrlEncoded
    @POST("GetOutStockList")
    fun GetOutStockList(@Field("EnterpriseID") EnterpriseID: String, @Field("pageIndex") pageIndex: Int,
                        @Field("pageSize") pageSize: Int, @Field("CustomerID") CustomerID: String,
                        @Field("StateID") StateID: String, @Field("OutCode") OutCode: String): Observable<MutableList<OutStock>>

    /**
     * 获取经销商列表
     */
    @FormUrlEncoded
    @POST("GetCustomerList")
    fun GetCustomerList(@Field("EnterpriseID") EnterpriseID: String, @Field("CustomerName") CustomerName: String,
                        @Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int): Observable<MutableList<CustomerInfo>>

    /**
     * 获取出库订单详情
     */
    @FormUrlEncoded
    @POST("GetOutStockInfo")
    fun OutStockInfo(@Field("OutID") OutID: String): Observable<ResultBean<OutStockInfo>>

    /**
     * 获取出库清单
     */
    @FormUrlEncoded
    @POST("GetOutStockDetailList")
    fun GetOutStockDetailList(@Field("OutID") OutID: String, @Field("pageIndex") pageIndex: Int,
                              @Field("pageSize") pageSize: Int): Observable<MutableList<OutgoingBean>>

    /**
     * 获取经销商详情
     */
    @FormUrlEncoded
    @POST("GetCustomerInfo")
    fun GetCustomerInfo(@Field("CustomerID") CustomerID: String): Observable<ResultBean<CustomerDetail>>

    /**
     * 获取成品库存信息
     */
    @FormUrlEncoded
    @POST("ProductReport")
    fun ProductReport(@Field("EnterpriseID") EnterpriseID: String, @Field("pageIndex") pageIndex: Int,
                      @Field("pageSize") pageSize: Int, @Field("ProductName") ProductName: String): Observable<ResultBean<MutableList<StockProduct>>>

    /**
     * 追溯码查询详情
     */
    @FormUrlEncoded
    @POST("GetCodeInfo")
    fun GetCodeInfo(@Field("Code") Code: String): Observable<ResultBean<TraceCodeBean>>

    /**
     * 流通码查询详情
     */
    @FormUrlEncoded
    @POST("GetFlowCodeByCodeInfo")
    fun GetFlowCodeByCodeInfo(@Field("Code") Code: String): Observable<ResultBean<FlowCodeBean>>

    /**
     * 节点溯源录入
     */
    @FormUrlEncoded
    @POST("AddDetailOperaInfo")
    fun AddDetailOperaInfo(@Field("OperaID") OperaID: String, @Field("DetailID") DetailID: String, @Field("ModelID") ModelID: String,
                           @Field("OperaName") OperaName: String, @Field("OperaDate") OperaDate: String, @Field("Remark") Remark: String,
                           @Field("ProvinceName") ProvinceName: String, @Field("CityName") CityName: String, @Field("AreaName") AreaName: String,
                           @Field("Address") Address: String, @Field("EnterpriseID") EnterpriseID: String, @Field("CreateUserID") CreateUserID: String,
                           @Field("BatchID") BatchID: String): Observable<MsgResultBean>

    /**
     * 发送消息列表
     */
    @FormUrlEncoded
    @POST("GetNoticeList")
    fun GetNoticeList(@Field("pageIndex") pageIndex: Int, @Field("pageSize") pageSize: Int)
            : Observable<ResultBean<MutableList<SendOutNotice>>>

    /**
     *接收通知
     */
    @FormUrlEncoded
    @POST("GetNoticeUserList")
    fun GetNoticeUserList(@Field("CreateUserID") CreateUserID: String, @Field("pageIndex") pageIndex: Int,
                          @Field("pageSize") pageSize: Int): Observable<ResultBean<MutableList<ReceiveNotice>>>

    /**
     * 获取通知信息详情
     */
    @FormUrlEncoded
    @POST("GetNoticeInfo")
    fun GetNoticeInfo(@Field("NoticeID") NoticeID: String): Observable<ResultBean<NoticeInfo>>

}
